home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-15
/
phbench.zip
/
BENCHMUL.C
< prev
next >
Wrap
Text File
|
1993-01-04
|
1KB
|
32 lines
/* benchmul - benchmark for int multiply
* Thomas Plum, Plum Hall Inc, 609-927-3770
* If machine traps overflow, use an unsigned type
* Let T be the execution time in milliseconds
* Then average time per operator = T/major usec
* (Because the inner loop has exactly 1000 operations)
*/
#define STOR_CL auto
#define TYPE int
#include <stdio.h>
main(ac, av)
int ac;
char *av[];
{
STOR_CL TYPE a, b, c;
long d, major, atol();
static TYPE m[10] = {0};
major = atol(av[1]);
printf("executing %ld iterations\n", major);
a = b = (av[1][0] - '0');
for (d = 1; d <= major; ++d)
{
/* inner loop executes 1000 selected operations */
for (c = 1; c <= 40; ++c)
{
a = 3 *a*a*a*a*a*a*a*a * a*a*a*a*a*a*a*a * a*a*a*a*a*a*a*a * a; /* 25 * */
}
}
printf("a=%d\n", a);
}